<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
  
    </style>
</head>

<body>
    <div id="app">
      <input type="button" value="浪起来" @click='go'>
      <input type="button" value="低调" @click='stop'>
        <h4>{{msg}}</h4>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',//指定要控制的元素
            data: {
               msg:'猥琐发育，别浪，稳住我们能应！！！',
               intervalId:null
            },
            methods:{
               go(){

                if(this.intervalId!=null) return;
                  this.intervalId= setInterval(()=>{
                    console.log(this.msg)//this指new的这个vue实例
                   //获取到头的第一个字符
                   var start =this.msg.substring(0,1)
                   //获取到后面的所有字符
                   var end =this.msg.substring(1)
                   //重新拼接得到新的字符串，并付给this.msg
                   this.msg=end+start
                   },400)
                  
               },
               stop(){
                   clearInterval(this.intervalId);
                   this.intervalId=null
               }
            }
        })

    </script>
</body>

</html>